package com.isoftstone.service.Impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.isoftstone.dao.ChargeDao;
import com.isoftstone.entity.CK_Prescription;
import com.isoftstone.entity.C_Prescription;
import com.isoftstone.entity.Patient;
import com.isoftstone.entity.W_Prescription;
import com.isoftstone.service.ChargeService;

@Service("ChargeService")
public class ChargeServiceImpl implements ChargeService {
	
	@Autowired
	private ChargeDao ChargeDao;

	@Override
	public List<Patient> getPatient(String patient_name,String patient_idcard) {
		// TODO Auto-generated method stub
		List<Patient> patient = ChargeDao.getPatient(patient_name, patient_idcard);
		return patient;
	}

	@Override
	public List<C_Prescription> getCmPrescription(String guahao_id) {
		// TODO Auto-generated method stub
		List<C_Prescription> cmlist = ChargeDao.getCmPrescription(guahao_id);
		return cmlist;
	}

	@Override
	public List<W_Prescription> getWmPrescription(String guahao_id) {
		// TODO Auto-generated method stub
		List<W_Prescription> wmlist = ChargeDao.getWmPrescription(guahao_id);
		return wmlist;
	}

	@Override
	public List<CK_Prescription> getCkPrescription(String guahao_id) {
		// TODO Auto-generated method stub
		List<CK_Prescription> cklist = ChargeDao.getCkPrescription(guahao_id);
		return cklist;
	}

	@Override
	public boolean wmUpdate(String guahao_id,Double wm_amount_payed,String wm_id) {
		// TODO Auto-generated method stub
		if(guahao_id!=null){
			boolean flag =ChargeDao.wmUpdate(guahao_id,wm_amount_payed,wm_id);
			if(flag){
				return true;
			}
		}
		return false;
	}

	@Override
	public boolean cmUpdate(String guahao_id,Double cm_amount_payed,String cm_id) {
		// TODO Auto-generated method stub
		if(guahao_id!=null){
			boolean flag =ChargeDao.cmUpdate(guahao_id,cm_amount_payed,cm_id);
			if(flag){
				return true;
			}
		}
		return false;
	}

	@Override
	public boolean ckUpdate(String guahao_id,Double ck_amount_payed,String ck_id) {
		// TODO Auto-generated method stub
		if(guahao_id!=null){
			boolean flag =ChargeDao.ckUpdate(guahao_id,ck_amount_payed,ck_id);
			if(flag){
				return true;
			}
		}
		return false;
	}

	@Override
	public boolean insertFee(String cost_id, Double ls_price, Date ls_data) {
		// TODO Auto-generated method stub
		if(cost_id!=null && ls_price!=null &&ls_data!=null){
			boolean flag =ChargeDao.insertFee(cost_id, ls_price, ls_data);
			if(flag){
				return true;
			}
		}
		return false;
	}
	

}
